package com.zyz.I_多线程.常用方法;

/**
 * @author: vick
 * @Date: 2025/3/22
 * @Description: 获取main线程对象的名称和优先级
 * @version: 1.0
 */
public class PriorityThread1 {
    public static void main(String[] args) {
        Thread thread = new Thread("子线程") {
            @Override
            public void run() {
                System.out.println(getName() + "的优先级：" + getPriority());
            }
        };
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();

        System.out.println(Thread.currentThread().getName() + "的优先级：" + Thread.currentThread().getPriority());
    }
}
